.text
// 跟x86的汇编类似，把i的定义挪到了文件的头部
.local i
.comm i, 4, 4
.section .rodata
.LC0:
        .string "now i is %d\n"

.text
.globl m1
.type m1, @function
m1:
        addi sp, sp, -16
        sd ra, 8(sp)
        sd s0, 0(sp)

        lui a5, %hi(i)
        lw a5, %lo(i)(a5)
        addiw a5, a5, 1
        sext.w a5, a5
        lui a4, %hi(i)
        sw a5, %lo(i)(a4)

        lui a5, %hi(i)
        lw a1, %lo(i)(a5)
        lui a5, %hi(.LC0)
        addi a0, a5, %lo(.LC0)
        call printf

        ld ra, 8(sp)
        ld s0, 0(sp)
        addi sp, sp, 16
        jr ra

.globl main
.type main, @function
main:
        addi sp, sp, -16
        sd ra, 8(sp)
        sd s0, 0(sp)

        call m1
        call m1

        mv a0, zero
        ld ra, 8(sp)
        ld s0, 0(sp)
        addi sp, sp, 16
        jr ra
